public class Solution829 {
    public int consecutiveNumbersSum(int n) {
        n=n*2;
        int ans=0;
        for (int i=1;i*i<=n;i++){
            if (n%i==0){
                if (n/i+1-i>0 && (n/i+1-i)%2==0){
                    ans++;
                }
                if (i+1-n/i>0 && (i+1-n/i)%2==0){
                    ans++;
                }
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution829().consecutiveNumbersSum(15));
    }
}
